﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DgvFunction
{
    public partial class FrmEdit : Form
    {
        private int rowIndex;
        private int columnIndex;
        private string var;

        public string SettingVar;

        public Action<string> SettingAction;

        public FrmEdit(int rowIndex, int columnIndex, string var)
        {
            InitializeComponent();

            this.txt_Row.Text = rowIndex.ToString();
            this.txt_Column.Text = columnIndex.ToString();
            this.txt_VarValue.Text = var;
        }

        private void btn_Set_Click(object sender, EventArgs e)
        {
            // 调用委托传递设置的值
            SettingAction(txt_SetValue.Text);

            //SettingVar = txt_SetValue.Text;
            
            this.DialogResult = DialogResult.OK;

        }

        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
